load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "cascades",
    srcs = [
        "enforcer_rules.go",
        "implementation_rules.go",
        "optimize.go",
        "stringer.go",
        "transformation_rules.go",
    ],
    importpath = "github.com/pingcap/tidb/planner/cascades",
    visibility = ["//visibility:public"],
    deps = [
        "//expression",
        "//expression/aggregation",
        "//kv",
        "//parser/ast",
        "//parser/mysql",
        "//planner/core",
        "//planner/implementation",
        "//planner/memo",
        "//planner/property",
        "//planner/util",
        "//sessionctx",
        "//types",
        "//util/ranger",
        "//util/set",
    ],
)

go_test(
    name = "cascades_test",
    timeout = "short",
    srcs = [
        "enforcer_rules_test.go",
        "integration_test.go",
        "main_test.go",
        "optimize_test.go",
        "stringer_test.go",
        "transformation_rules_test.go",
    ],
    data = glob(["testdata/**"]),
    embed = [":cascades"],
    flaky = True,
    shard_count = 40,
    deps = [
        "//domain",
        "//expression",
        "//infoschema",
        "//parser",
        "//parser/model",
        "//planner/core",
        "//planner/memo",
        "//planner/property",
        "//sessionctx/variable",
        "//testkit",
        "//testkit/testdata",
        "//testkit/testsetup",
        "@com_github_pingcap_failpoint//:failpoint",
        "@com_github_stretchr_testify//require",
        "@org_uber_go_goleak//:goleak",
    ],
)
